//package com.he.DesignPatterns.iterator;
//
//import java.util.Arrays;
//import java.util.Iterator;
//import java.util.List;
//
///**
// * @description: TODO
// * @Author: HCL
// * @Date: 2024/9/4 11:35
// */
//public class Client {
//    public static void main(String[] args) {
//        //创建聚合对象
//        StudentAggregateImpl studentAggregate = new StudentAggregateImpl();
//
//        //添加元素到聚合对象
//        studentAggregate.addStudent(new Student("张三","001"));
//        studentAggregate.addStudent(new Student("李四","002"));
//        studentAggregate.addStudent(new Student("王五","003"));
//        studentAggregate.addStudent(new Student("赵六","004"));
//
//        //创建迭代器类对象
//        StudentIterator studentIterator = studentAggregate.getStudentIterator();
//
//        //遍历
//        while (studentIterator.hashNext()){
//            System.out.println(studentIterator.next().toString());
//        }
//
//        //其实就是
//        System.out.println("===========================================");
//        List<Student> list = Arrays.asList(
//                new Student("张三", "001"),
//                new Student("李四", "002"),
//                new Student("王五", "003"),
//                new Student("赵六", "004"));
//        Iterator<Student> iterator = list.iterator();
//        while (iterator.hasNext()) {
//            System.out.println(iterator.next().toString());
//        }
//    }
//}
